from django.contrib import admin
from .models import ProductType
from .models import Product
from .models import ProductBacklog
from .models import SprintBacklog
# Register your models here.


class ChoiceProductBacklog(admin.StackedInline):
    model = ProductBacklog
    extra = 0

class ProductAdmin(admin.ModelAdmin):
    # ...
    list_display = ('product', 'product_code', 'master', 'operation')
    list_filter = ['operation', 'master']
    search_fields = ['product']
    inlines = [ChoiceProductBacklog]




class ChoiceSprint(admin.StackedInline):
    model = SprintBacklog
    extra = 0

class ProductBacklogAdmin(admin.ModelAdmin):
    # ...
    list_display = ('product_backlog', 'product', 'responsible', 'operation')
    list_filter = ['operation', 'product','responsible']
    search_fields = ['product_backlog']

    inlines = [ChoiceSprint]

class SprintBacklogAdmin(admin.ModelAdmin):
    # ...
    list_display = ('sprint_backlog', 'product_backlog', 'operation')
    list_filter = ['operation', 'product_backlog', 'product_backlog__responsible']
    search_fields = ['sprint_backlog']

admin.site.register(ProductType)
admin.site.register(Product, ProductAdmin)
admin.site.register(ProductBacklog, ProductBacklogAdmin)
admin.site.register(SprintBacklog, SprintBacklogAdmin)

